<template>
	<view class="content" :style="{
      backgroundColor: Merchant.Content.backgroundColor,
      backgroundImage: Merchant.Content.backgroundImage? 'url(' + Domain_IMG + Merchant.Content.backgroundImage + ')': '',
      backgroundSize: Merchant.Content.backgroundSize,
      backgroundRepeat: Merchant.Content.backgroundRepeat,
    }">
		<view id="fixed" class="fixed-top bg-white" style="height: 200rpx; padding-top: 40rpx">
			<view class="px-1 mt-5 flex " style="height: 53rpx; position: relative">
				<image  style="height: 100%; position:absolute; left: 20rpx;" :src="Domain_ICON+'/ShiJiHuaLianLoGo.jpg'" mode="heightFix"></image>
				<!-- 切换商户页面 -->
				<!-- <view  class="flex justify-between" style="margin: auto; width: 40%;">
					<view>
						<text class="font font-weight-bold" @click="user('/pages/index/index')">我是客户</text>
					</view>
					<view class="border-bottom border-info">
						<text class="font font-weight-bold text-info">我是商户</text>
					</view>
				</view> -->
			</view>
			<!-- #ifdef MP -->
			<!-- 搜索框 -->
			<!-- <view class="flex align-center mt-1" style="height: 74rpx">
				
				<view class="ml-2 flex align-center justify-between flex-1 rounded-circle px-1"
					style="background-color: #f6f7f8; color: #959fa0; height: 30px" @click="GoSearch()">
					<text class="font-small pl-2">搜索您想要的商品</text>
					<image :src="Domain_ICON + '/search.png'" mode="" style="margin-right: 8px; width: 40rpx; height: 40rpx">
					</image>
				</view>
				<view class="flex align-center p-1 mx-2"
					style="background-color: #f6f7f8; color: #959fa0; border-radius: 50%" @click="orderify()">
					<image style="width: 32rpx" :src="Domain_ICON + '/orders.png'" mode="widthFix"></image>
				</view>
			</view> -->
			<!-- #endif -->
		</view>
		<!-- 轮播图 -->
		<view class="" :style="'height:' + fixedHeight + 'px'"></view>
		<swiperDot v-show="swipers.length > 0 ? true : false" class="position-relative" :current="current"
			:info="swipers">
			<swiper :autoplay="true" :interval="3000" :duration="500" circular style="height: 500rpx"
				@change="changeIndicatorDots">
				<swiper-item @click="handleDetails(item.Article_SerialNumber,item.Wholesale_Unit_Price_SerialNumber)
          " v-for="(item, index) in swipers" :key="index">
					<image :src="Domain_IMG + item.Picture_URL" mode="sapectFill" style="height: 500rpx; width: 100%">
					</image>
				</swiper-item>
			</swiper>
		</swiperDot>
		<!-- icon搜索 -->
		<!-- <view class="px-5 my-5 flex flex-wrap">
			<view @click="handleSkip(item.url,item.ShopColumn_Id)" class="flex flex-column align-center justify-center mt-2"
				style="width:25%;height: 100rpx;" v-for="(item,index) in myItemsArr" :key="item.ShopColumn_Id">
				<image style="height: 100rpx;width: 100rpx;" :src="Domain_IMG + item.src" mode="heightFix"></image>
				<text class="font-sm">{{item.name}}</text>
			</view>
		</view> -->
		<!-- 本周推荐 -->
		<view class="pl-3 pb-2" v-if="weeklyRecommend.length > 0">
			<text class="h3 text-success font-weight-bold">本周推荐</text>
			<view class="flex" style="overflow-x: scroll">
				<view class="rounded-lg bg-light mr-2" style="width: 200rpx; height: 270rpx"
					v-for="(item, index) in weeklyRecommend" :key="index">
					<image class="rounded-lg" style="width: 200rpx; height: 200rpx" :src="Domain_IMG + item.src"
						mode=""></image>
					<view class="text-ellipsis" style="70rpx">
						<text class="font-sm">商品名称</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 导航栏 -->
		<scroll-view id="tab" scroll-x="true" scroll-with-animation :scroll-left="scrollLeft" class="pt-2 pb-2">
			<view class="pl-3 pr-3 flex justify-between align-end" :style="{ width: Width() }">
				<text :id="'tab_' + index" class="h4 text-hover-dark font-weight-bold"
					:class="index == tabsIndex ? 'first' : ''" v-for="(item, index) in tabs" :key="index"
					@tap="handleTab(index)">{{ item.Column_Name }}</text>
			</view>
		</scroll-view>
		<!-- 导航栏悬停部分 -->
		<scroll-view class="pt-2 pb-2 tabs-fixed" scroll-x="true" scroll-with-animation :scroll-left="scrollLeft"
			v-if="topfixed" style="width: 100%">
			<view class="pl-3 pr-3 flex justify-between align-end" :style="{ width: Width() }">
				<text class="h4 text-hover-dark font-weight-bold" :class="index == tabsIndex ? 'first' : ''"
					v-for="(item, index) in tabs" :key="index" @tap="handleTab(index)">{{ item.Column_Name }}</text>
			</view>
		</scroll-view>
		<!-- 商品卡片 -->
		<view :id="'item' + index" class="px-3 pb-3" v-for="(item, key) in tabs" :key="key">
			<view class="h4 text-hover-dark font-weight-bold pt-2 pb-2" v-if="index != 0">{{ key }}</view>
			<view class="flex flex-wrap justify-between">
				<view class="mb-3 rounded-lg" :class="[index % 2 == 0 ? 'bg-light' : 'bg-white']"
					style="width: 320rpx; position: relative" v-for="(item_, index_) in item" :key="index_" @click="handleDetails(item_.Article_SerialNumber, item_.Wholesale_Unit_Price_SerialNumber, item_.Starting_Quantity)">
					<image class="rounded-lg" style="width: 320rpx; height: 320rpx"
						:src="Domain_IMG + item_.Picture_URL" mode=""></image>
					<view class="flex flex-column ml-2 text-ellipsis" style="70rpx">
						<view class="flex text-ellipsis">
							<view class="p-1 mr-1 bg-info text-white" style=" border-radius: 10rpx;font-size: 22rpx;font-family: PingFang SC;">
								世纪华联
							</view>
							<view class="text-ellipsis" style="text-align: left; width: 50%; font-family: PingFang SC">
								<text class="font">{{ item_.Article_Name }}</text>
							</view>
						</view>
						<text style="display: block"
							class="font-small text-secondary my-1">{{ item_.Category_Name }}</text>
						<text style="display: block"
							class="font-small text-secondary my-1">最低购买量{{ item_.Starting_Quantity }}个</text>
						<text style="display: block"
							class="font-small text-secondary my-1">每次购买量{{ item_.Unit_Quantity }}个</text>
						<text style="display: block"
							class="font-small text-secondary my-1">仅剩{{ item_.Remain_Quantity }}件</text>
						<text style="display: block" class="h4 font-weight-bold my-1">￥{{ item_.Unit_Price }}</text>
					</view>
					<!-- v-if="!Car.some(i=>i.Article_SerialNumber==item_.Article_SerialNumber)" -->
					<view style="background-color: #dc3545; border-radius: 50%;"
						class="add flex justify-center align-center rounded-circle"
						@click.stop="addShopCar(item_)"
					>
						<uni-icons type="plusempty" color="white" size="20"></uni-icons>
					</view>
					<!-- <view v-else class="flex justify-center align-center rounded-circle"
							style="position: absolute; right: 20rpx;bottom: 20rpx;">
							<view @click.stop="subGoods(item_.Article_SerialNumber)"
								class="font-md text-center text-white flex justify-center align-center"
								:style="{backgroundColor:imageURL.Detail.themeColor}"
								style="width: 50rpx;height: 50rpx;">-</view>
							<view class="text-center font bg-white border " style="width: 50rpx;height: 50rpx;"
								:style="'border-top:1rpx solid '+imageURL.Detail.themeColor+';border-bottom:1rpx solid '+imageURL.Detail.themeColor+'; color:'+imageURL.Detail.themeColor+'; box-sizing: border-box;'">
								{{parseInt(Car.filter(i=>i.Article_SerialNumber==item_.Article_SerialNumber)[0].Quantity)}}
							</view>
							<view @click.stop="addGoods(item_.Article_SerialNumber)"
								class="font-md text-center text-white flex justify-center align-center"
								:style="{backgroundColor:imageURL.Detail.themeColor}"
								style="width: 50rpx;height: 50rpx;">+</view>
					</view> -->
				</view>
			</view>
		</view>
		<!-- 悬浮按钮 -->
		<view class="button flex flex-column-reverse">
			<view class="shadow mt-2 bg-white rounded-circle flex justify-center align-center"
				style="width: 100rpx; height: 100rpx; position: relative" @click="handleBtn(item.title)"
				v-if="item.isShow" v-for="(item, index) in btn" :key="index">
				<i v-if="item.title == 'car' && total > 0" class="bg-danger rounded-circle text-white px-1 font-sm"
					style="position: absolute; top: -5rpx; left: -5rpx">{{ total }}</i>
				<image :src="Domain_ICON + item.icon" style="width: 50rpx; height: 50rpx" mode=""></image>
				<button id="shareBtn" class="rounded-circle" open-type="share" v-if="item.title == 'share'">
					分享
				</button>
			</view>
		</view>
		<!-- 底部切换 -->
		<tabsBottomMerchant :tabId="0"></tabsBottomMerchant>
	</view>
</template>

<script>
	const app = getApp();
	import times from "@/mixins/time.js";
	import tabsBottomMerchant from "@/components/tabs/tabs-bottom-Merchant.vue";
	import swiperDot from "@/components/comon/swiper-doc.vue";
	import { WXShopCarQuantity } from "@/api/WeChat.js";
	import { WXAddAction } from "@/api/global.js";
	import {
		getMerchantList
	} from "@/api/merchant.js";
	export default {
		components: {
			swiperDot, //轮播图组件
			tabsBottomMerchant,
		},
		data() {
			return {
				OpenID: "",
				ShareOpenID: "",
				Enterprise_Info_SerialNumber: "",
				App_ID: "",
				Dealer_Authority: "0", //认证身份
				Domain_IMG: app.globalData.Domain_IMG, //全局变量域名
				current: 0, // 标识当前选中的图片序列号
				fixedHeight: 0, //顶部高度
				tabsIndex: 0, // 导航栏被选中栏目的索引，默认0
				topfixed: false, //控制悬停导航栏是否显示
				isClick: false, //为了解决点击滑动的bug，点击的时候，滑动里面不处理任何逻辑
				loading: false, //节流
				tabsHeight: 0, //导航栏高度
				scroll_top: 0, //滚动的距离
				total: 0, //数量
				times: "",
				scrollLeft: 0, //导航栏横向滚动距离
				scrollViewWidth: 0, //初始化滚动的宽度
				itemsHeight: [], //导航栏选项内容到顶部距离-目标节点的数组
				swipers: [], //轮播图
				tabs: [], //选项卡数据
				myItemsArr: [], //主类目数据
				weeklyRecommend: [],
				btn: [{
						//右侧悬浮按钮
						title: "serve",
						icon: "/serve.png",
						isShow: true,
					},
					{
						title: "car",
						icon: "/shop_car.png",
						isShow: true,
					},
				],
				Merchant: {
					Content: {
						//总背景
						backgroundColor: "#DC4108",
						backgroundImage: "", //背景图片"/6c1e39e6b6bc4258537d8b6691d41e4.png"
						backgroundSize: "100% auto", //尺寸
						backgroundRepeat: "no-repeat", //是否重复渲染
						Logo: false, //logo展示
					},
					Icon: {
						//图标
						textColor: "#000",
					},
					Tabs: {
						//导航栏
						backgroundColor: "rgba(0, 0, 0, 0.5)",
						textColor: "#a3ff0e",
						selectColor: "#dcdc08",
						//区域
					},
					Detail: {
						//商品卡片
						backgroundColor: "#fff", //背景颜色
						themeColor: "#dcdc08", //主体颜色
					},
					Merchant: {
						backgroundColor: "#fff", //背景颜色
						Color: "#dcdc08", //主体颜色
					},
				},
				Domain_ICON: app.globalData.Domain_ICON, //全局变量域名
				Car: [],//购物车

			};
		},
		onLoad(e) {
			if (app.globalData.enterprise != "") {
				uni.showLoading({
					title: "加载中",
				});
			}
			const openid = uni.getStorageSync("openid");
			uni.setStorageSync("ShareUrl", `/pages/index/index?openid=${openid}`);
			if (e.openid) {
				this.ShareOpenID = e.openid;
				this.OpenID = uni.getStorageSync("openid");
				this.Enterprise_Info_SerialNumber = app.globalData.enterprise;
				this.App_ID = uni.getStorageSync("App_ID");
				//不可以自己分享给自己
				if (this.ShareOpenID != this.OpenID) {
					uni.request({
						//获取点击的分享者传给服务器
						url: app.globalData.Domain_Name + "/WXMemberBehaviorAddAction",
						header: {
							"Content-Type": "application/x-www-form-urlencoded",
						},
						method: "POST",
						data: {
							Parent_Open_ID: this.ShareOpenID,
							Open_ID: this.OpenID,
							Enterprise_Info_SerialNumber: this.Enterprise_Info_SerialNumber,
							App_ID: this.App_ID,
							Meet_Type: "分享",
						},
						success: (res) => {},
					});
				}
			}
			this.fixed(); //获取顶部导航栏高度
			this.scrollWidth(); //获取屏幕宽度
			this.getGoods(); //查询商品信息
			uni.hideLoading();
			this.ShopGoods();//查询购物车
		},
		onShow() {
			if (app.globalData.openid != "") {
				this.ShopCarQuantity(app.globalData.openid);
			}
		},
		onPageScroll(e) {
			//页面滚动
			this.scroll_top = e.scrollTop;
			//导航栏是否悬空
			uni
				.createSelectorQuery()
				.select("#tab")
				.boundingClientRect((data) => {
					if (data.top <= 108) {
						this.topfixed = true;
					} else {
						this.topfixed = false;
					}
				})
				.exec();
			//导航栏栏目随对应模块自动切换
			if (!this.isClick) {
				this.scrollTochang(e.scrollTop);
			}
		},
		methods: {
			//添加购物车
			addShopCar(
				item_
			) {
				//加入购物车
				// this.time();
				// if (!this.loading) {
				// 	this.loading = true;
				// 	uni.showLoading({
				// 		title: "提交中...",
				// 	});
				// 	// uni.request({
				// 	// 	header: {
				// 	// 		"Content-Type": "application/x-www-form-urlencoded",
				// 	// 	},
				// 	// 	url: app.globalData.Domain_Name + "/WXCheckShopCarAction", //
				// 	// 	method: "POST",
				// 	// 	data: {
				// 	// 		Open_ID: app.globalData.openid,
				// 	// 		App_ID: app.globalData.appid,
				// 	// 		Sales_Unit_Price_Stock_SerialNumber,
				// 	// 	},
				// 	// 	success: (res) => {
				// 	// 		if (res.data.length == 0) {
				// 	// 			uni.request({
				// 	// 				header: {
				// 	// 					"Content-Type": "application/x-www-form-urlencoded",
				// 	// 				},
				// 	// 				url: app.globalData.Domain_Name + "/WXAddAction", //
				// 	// 				method: "POST",
				// 	// 				data: {
				// 	// 					Data: JSON.stringify({
				// 	// 						sales_order: [{
				// 	// 							Sales_Order_SerialNumber: "",
				// 	// 							Store_SerialNumber: Store_SerialNumber,
				// 	// 							Sales_Date: this.times,
				// 	// 							Open_ID: app.globalData.openid,
				// 	// 							Sales_Amount: Sales_Unit_Price,
				// 	// 							Collection_Amount: 0,
				// 	// 							Sales_ID: "xiaoshou1",
				// 	// 							Receive_Type: 0,
				// 	// 							Refund_Type: 0,
				// 	// 							Row_Status: 8,
				// 	// 							App_ID: app.globalData.appid,
				// 	// 							Enterprise_Info_SerialNumber: app
				// 	// 								.globalData.enterprise,
				// 	// 							Children: {
				// 	// 								sales_order_detail: [{
				// 	// 									Sales_Order_Detail_SerialNumber: "",
				// 	// 									Sales_Order_SerialNumber: "",
				// 	// 									Sales_Unit_Price_Stock_SerialNumber: Sales_Unit_Price_Stock_SerialNumber,
				// 	// 									Article_SerialNumber: Article_SerialNumber,
				// 	// 									Article_Specifications_SerialNumber: Article_Specifications_SerialNumber,
				// 	// 									Sign: "无货货主",
				// 	// 									Quantity: 1,
				// 	// 									Unit_Price: Unit_Price,
				// 	// 									Sales_Unit_Price: Sales_Unit_Price,
				// 	// 									Amount: Sales_Unit_Price,
				// 	// 									Receive_Type: 0,
				// 	// 									Refund_Type: 0,
				// 	// 									Row_Status: 8,
				// 	// 									Enterprise_Info_SerialNumber: app
				// 	// 										.globalData
				// 	// 										.enterprise,
				// 	// 								}, ],
				// 	// 							},
				// 	// 						}, ],
				// 	// 					}),
				// 	// 					Open_ID: app.globalData.openid,
				// 	// 				},
				// 	// 				success: (res) => {
				// 	// 					if (res.data.Status == "success") {
				// 	// 						uni.showToast({
				// 	// 							title: "已加入购物车！",
				// 	// 							icon: "none",
				// 	// 						});
				// 	// 						this.total++;
				// 	// 						this.ShopGoods();
				// 	// 					} else {
				// 	// 						uni.showToast({
				// 	// 							title: "系统繁忙！",
				// 	// 							icon: "error",
				// 	// 						});
				// 	// 					}
				// 	// 				},
				// 	// 				complete: () => {
				// 	// 					this.loading = false;
				// 	// 					uni.hideLoading();
				// 	// 				},
				// 	// 			});
				// 	// 		} else {
				// 	// 			this.loading = false;
				// 	// 			uni.hideLoading();
				// 	// 			uni.showToast({
				// 	// 				title: "购物车存在该商品！",
				// 	// 				icon: "none",
				// 	// 			});
				// 	// 		}
				// 	// 	},
				// 	// });

				// }
				let item = {
					Purchase_Order_SerialNumber: "",
					Supplier_SerialNumber:"",
					Purchase_Date:"",
					Purchase_Amount:"",
					Transaction_Type:"",
					Paid_Amount:"",
					Return_Amount:"",
					Apply_Amount:"",
					Confirm_Amount:"",
					Row_Status:8,
					Enterprise_Info_SerialNumber:app.globalData.memberInfo.Enterprise_Info_SerialNumber,
					Children:{
						purchase_order_detail:[]
					}
				}
				item.Children.purchase_order_detail.push(
					{
						Purchase_Order_Detail_SerialNumber:"",
						Purchase_Order_SerialNumber:"",
						Unit_Price_SerialNumber:item_.Wholesale_Unit_Price_SerialNumber,
						Brand_SerialNumber:item_.Brand_SerialNumber,
						Article_Specifications_SerialNumber:item_.Article_Specifications_SerialNumber,
						Article_SerialNumber:item_.Article_SerialNumber,
						Article_UnitPrice:item_.Article_UnitPrice,
						Purchase_UnitPrice:item_.Unit_Price,
						Quantity:item_.Starting_Quantity,
						Receipt_Quantity:"",
						Not_Receipt_Quantity:"",
						Shippment_Quantity:"",
						Inventory_Quantity:"",
						Amount:"",
					}
				);
				console.log(item_);
				this.addCar(item); //
			},
			async addCar(item) {//添加购物车方法
				console.log(1);
				const res = await WXAddAction({
					Data: JSON.stringify({ purchase_order: [item] }),
					Open_ID: app.globalData.openid,
				})
				console.log(res);
			},
			//获取购物车数量
			async ShopGoods() {
				const res = await WXShopCarQuantity({
					App_ID: app.globalData.appid,
					Open_ID: app.globalData.openid,
					Enterprise_Info_SerialNumber: app.globalData.enterprise,
				});
				if (res.Status == "success") {
					this.total = 0;
					res.Data.forEach((item) => {
						this.total = this.total + parseInt(item.Quantity);
					});
					this.Car = res.Data;
					console.log(this.Car);
				}
			},
			user(url) {
				//商户跳转方法
				uni.showModal({
					title: "提示",
					content: "您将进入用户页面,是否继续",
					success: function(res) {
						//5_2跳转到个人信息详情页
						if (res.confirm) {
							//跳转到页面
							uni.switchTab({
								url,
							});
						} else if (res.cancel) {
							//5_1关闭弹窗
							_this.$scope.globalData.memberInfo = _this.memberInfo;
						}
					},
				});
			},
			Width() {
				//自适应导航栏外层长度
				return this.tabs.length * 180 + "rpx";
			},
			scrollWidth() {
				//初始化求出tab滚动宽度
				this.createSelectorQuery()
					.select("#tab")
					.boundingClientRect((rect) => {
						this.scrollViewWidth = Math.round(rect.width);
					})
					.exec();
			},
			scrollHeight() {
				//tab下所有内容，其每个内容的高度
				this.$nextTick(() => {
					//渲染完成后再执行
					//导航栏是否悬空
					uni
						.createSelectorQuery()
						.select("#tab")
						.boundingClientRect((data) => {
							if (data) this.tabsHeight = data.height;
						})
						.exec();
					for (const key in this.tabs) {
						this.tabs[key].forEach((item, index) => {
							uni
								.createSelectorQuery()
								.select(`#item${index}`)
								.boundingClientRect((res) => {
									//(res.top + res.height)为导航栏 (44 + this.tabsHeight)为目标节点
									if (res)
										this.itemsHeight.push(
											res.top + res.height - (108 + this.tabsHeight)
										);
								})
								.exec();
						});
					}
					//
				});
			},
			handleDetails(
				Article_SerialNumber,
				Wholesale_Unit_Price_SerialNumber,
				Starting_Quantity
			) {
				//点击进入"商品详情"页
				uni.navigateTo({
					url: "/pages/Merchant/details?Article_SerialNumber=" +
						Article_SerialNumber +
						"&Wholesale_Unit_Price_SerialNumber=" +
						Wholesale_Unit_Price_SerialNumber +
						"&Starting_Quantity=" +
						Starting_Quantity,
				});
			},
			handleSkip(url, id) {
				//点击跳转"搜索结果"页
				uni.navigateTo({
					url: url + "?id=" + id,
				});
			},
			async ShopCarQuantity(openid) {
				const res = await WXShopCarQuantity({
					App_ID: app.globalData.appid,
					Open_ID: openid,
					Enterprise_Info_SerialNumber: app.globalData.enterprise,
				});
				if (res.Status == "success") {
					this.total = parseInt(res.total);
				}
			},
			handleTab(index) {
				//点击导航栏后选项据中且页面滚动到对应位置
				const that = this;
				this.isClick = true;
				this.tabsIndex = index;
				//选项据中
				uni
					.createSelectorQuery()
					.select("#tab_" + index)
					.boundingClientRect((rect) => {
						this.scrollLeft =
							rect.left - this.scrollViewWidth / 2 + rect.width / 2;
					})
					.exec();

				//页面滚动
				uni
					.createSelectorQuery()
					.select("#item" + index)
					.boundingClientRect((data) => {
						let scrollTop = data.top - (108 + this.tabsHeight) + this.scroll_top;
						uni.pageScrollTo({
							scrollTop,
							duration: 300,
							complete: function() {
								const timer = setTimeout(() => {
									that.isClick = false; // 关闭(放开对onPageScroll的限制)
									clearTimeout(timer);
								}, 500); //解决ios和安卓、鸿蒙系统兼容性问题,但在开发者环境会出现问题
							},
						});
					})
					.exec();
			},
			scrollTochang(scrollTop) {
				//页面滚动到指定位置时切换tabs导航栏选项(点击导航栏执行时不生效)
				const index = this.itemsHeight.findIndex((item) => scrollTop < item);
				if (this.tabsIndex != index) {
					this.tabsIndex = index;
					//选项据中
					uni
						.createSelectorQuery()
						.select("#tab_" + index)
						.boundingClientRect((rect) => {
							if (rect)
								this.scrollLeft =
								rect.left - this.scrollViewWidth / 2 + rect.width / 2;
						})
						.exec();
				}
			},
			GoSearch() {
				//跳转到"搜索"页
				uni.navigateTo({
					url: "/pages/index/search",
				});
			},
			orderify() {
				//跳转到"订单"页
				uni.navigateTo({
					url: `/pages/my/order?id=0`,
				});
			},
			changeIndicatorDots(e) {
				//每次轮播修改轮播图数
				this.current = e.detail.current;
			},
			//根据数组中所有对象某个值进行排序
			Objectsort(property) {
				return function(Obj1, Obj2) {
					return Obj1[property] - Obj2[property];
				};
			},
			handleBtn(title) {
				//点击屏幕左侧悬浮按钮"客服"按钮后对应操作
				if (title == "serve") {
					//进入"客服"页
					uni.navigateTo({
						url: "../serves/serves",
					});
				} else if (title == "car") {
					//进入"购物车"页
					uni.navigateTo({
						url: "/pages/Merchant/Merchant_cat",
					});
				}
			},
			time() {
				this.times = times.nowtime();
			},
			fixed() {
				//顶部模块高度获取
				const query = uni.createSelectorQuery();
				query
					.select("#fixed")
					.boundingClientRect((data) => {
						this.fixedHeight = data.height;
					})
					.exec();
			},
			async getGoods() {
				//商品
				const res = await getMerchantList({
					App_ID: app.globalData.appid,
					Enterprise_Info_SerialNumber: app.globalData.enterprise,
				});
				console.log(res);
				this.tabs = res.Data;
				this.scrollHeight();
			},
			// addShopCar(
			// 	Store_SerialNumber,
			// 	Sales_Unit_Price,
			// 	Sales_Unit_Price_Stock_SerialNumber,
			// 	Article_SerialNumber,
			// 	Article_Specifications_SerialNumber,
			// 	Unit_Price
			// ) {
			// 	//加入购物车
			// 	this.time();
			// 	if (!this.loading) {
			// 		this.loading = true;
			// 		uni.showLoading({
			// 			title: "提交中...",
			// 		});
			// 		uni.request({
			// 			header: {
			// 				"Content-Type": "application/x-www-form-urlencoded",
			// 			},
			// 			url: app.globalData.Domain_Name + "/WXCheckShopCarAction", //
			// 			method: "POST",
			// 			data: {
			// 				Open_ID: app.globalData.openid,
			// 				App_ID: app.globalData.appid,
			// 				Sales_Unit_Price_Stock_SerialNumber,
			// 			},
			// 			success: (res) => {
			// 				if (res.data.length == 0) {
			// 					uni.request({
			// 						header: {
			// 							"Content-Type": "application/x-www-form-urlencoded",
			// 						},
			// 						url: app.globalData.Domain_Name + "/WXAddAction", //
			// 						method: "POST",
			// 						data: {
			// 							Data: JSON.stringify({
			// 								sales_order: [{
			// 									Sales_Order_SerialNumber: "",
			// 									Store_SerialNumber: Store_SerialNumber,
			// 									Sales_Date: this.times,
			// 									Open_ID: app.globalData.openid,
			// 									Sales_Amount: Sales_Unit_Price,
			// 									Collection_Amount: 0,
			// 									Sales_ID: "xiaoshou1",
			// 									Receive_Type: 0,
			// 									Refund_Type: 0,
			// 									Row_Status: 8,
			// 									App_ID: app.globalData.appid,
			// 									Enterprise_Info_SerialNumber: app
			// 										.globalData.enterprise,
			// 									Children: {
			// 										sales_order_detail: [{
			// 											Sales_Order_Detail_SerialNumber: "",
			// 											Sales_Order_SerialNumber: "",
			// 											Sales_Unit_Price_Stock_SerialNumber: Sales_Unit_Price_Stock_SerialNumber,
			// 											Article_SerialNumber: Article_SerialNumber,
			// 											Article_Specifications_SerialNumber: Article_Specifications_SerialNumber,
			// 											Sign: "无货货主",
			// 											Quantity: 1,
			// 											Unit_Price: Unit_Price,
			// 											Sales_Unit_Price: Sales_Unit_Price,
			// 											Amount: Sales_Unit_Price,
			// 											Receive_Type: 0,
			// 											Refund_Type: 0,
			// 											Row_Status: 8,
			// 											Enterprise_Info_SerialNumber: app
			// 												.globalData
			// 												.enterprise,
			// 										}, ],
			// 									},
			// 								}, ],
			// 							}),
			// 							Open_ID: app.globalData.openid,
			// 						},
			// 						success: (res) => {
			// 							if (res.data.Status == "success") {
			// 								uni.showToast({
			// 									title: "已加入购物车！",
			// 									icon: "none",
			// 								});
			// 								this.total++;
			// 							} else {
			// 								uni.showToast({
			// 									title: "系统繁忙！",
			// 									icon: "error",
			// 								});
			// 							}
			// 						},
			// 						complete: () => {
			// 							this.loading = false;
			// 							uni.hideLoading();
			// 						},
			// 					});
			// 				} else {
			// 					this.loading = false;
			// 					uni.hideLoading();
			// 					uni.showToast({
			// 						title: "购物车存在该商品！",
			// 						icon: "none",
			// 					});
			// 				}
			// 			},
			// 		});
			// 	}
			// },
		},
	};
</script>

<style lang="scss">
	.tabs-fixed {
		position: fixed;
		top: 108px;
		z-index: 1030;
	}

	.first {
		font-size: 45rpx;
		line-height: 1.8;
		color: #17a2b8;
		font-weight: 700;
	}

	.add {
		position: absolute;
		bottom: 20rpx;
		right: 20rpx;
		width: 50rpx;
		height: 50rpx;
		line-height: 50rpx;
	}

	.button {
		position: fixed;
		bottom: 200rpx;
		right: 20rpx;
		width: 100rpx;
	}
</style>